﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script>
        let arr = [6, 5, 4, 3, 2, 1];
        for (var i = 0; i < arr.length; i++) {
            for (var j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j]>arr[j+1]) {
                    let tame = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j+ 1] = tame;
                }
            }
        } console.log(arr);

    </script>
</body>
</html>